using System.ComponentModel.Design;
using System.Text.RegularExpressions;
using EnvDTE;
using EnvDTE80;
using Microsoft.Practices.ComponentModel;
using Microsoft.Practices.RecipeFramework;
using Microsoft.Practices.RecipeFramework.Library;
using VSSDKAssist.Assets.Actions.Base;
using VSLangProj;
using System;
using VSSDKAssist.Assets.Enums;

namespace VSSDKAssist.Assets.Actions.VisualStudio
{
	/// <summary>
	/// Action that sets ProjectItem CopyToOutput Action
	/// </summary>
    public class SetCopyToOutputAction : ActionBase
	{
		#region Properties
		/// <summary>
		/// Gets or sets the project item.
		/// </summary>
		/// <value>The project item.</value>
        [Input(Required = true)]
        public ProjectItem ProjectItem { get; set; }

        [Input(Required = true)]
        public CopyToOutput CopyToOutput { get; set; }
		#endregion

		#region Protected Implementation
		/// <summary>
		/// Called when [execute].
		/// </summary>
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
		protected override void OnExecute()
		{
			if(this.ProjectItem.Properties != null)
            {
                this.ProjectItem.Properties.Item("CopyToOutputDirectory").Value = this.CopyToOutput;
			}
		}

		/// <summary>
		/// Called when [undo].
		/// </summary>
		protected override void OnUndo()
		{
			//Do nothing
		}
		#endregion
	}
}